//
//  TDMinePWGetPhoneC.m
//  TBRentClient
//
//  Created by tonbright on 2018/7/5.
//  Copyright © 2018年 tonbright. All rights reserved.
//

#import "TDMinePWGetPhoneC.h"

#import "NetWorkRequest.h"
//#import "TDInputYanZhengCodeC.h"
#import "TDMinePWCheckYanZhengC.h"
@interface TDMinePWGetPhoneC ()

@property (weak, nonatomic) IBOutlet UILabel *lbe_des;

@property (weak, nonatomic) IBOutlet UITextField *tf_phoneNum;

@end

@implementation TDMinePWGetPhoneC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
}

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
}



- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self.tf_phoneNum becomeFirstResponder];
}

- (void)setupUI {
    self.view.backgroundColor = [UIColor whiteColor];
//    if (!_isRegister) {
//        _lbe_des.text = @"忘记密码?";
//        _tf_phoneNum.placeholder = @"请输入您的手机号以查找您的账号";
//    }
}


- (IBAction)closeBtnClick:(UIButton *)sender {
    [self.navigationController popViewControllerAnimated:YES];
}


- (IBAction)nextBtnClick:(UIButton *)sender {
    [AppSetting shareAppSetting].isFromRegist = _isRegister;//是否从注册界面跳转-----
    [self.view endEditing:YES];
    // MARK: - 登录操作--------------
    NSString *phone = self.tf_phoneNum.text;
    [AppSetting shareAppSetting].phone = phone;
    NSDictionary *parDic = @{@"phone":phone};
    if ([HelpObject isBlankString:phone]) {
        self.noticeText = @"请先输入手机号码";
        return;
    }else if (phone.length != 11) {
        self.noticeText = @"请输入11位手机号码";
        return;
    }
    __weak typeof(self) weakSelf = self;
    [self progressHUDShowWithText:@"获取验证码..."];
    [NetWorkRequest postNetRequestData:checkPhoneNum parmeters:parDic response:^(NSDictionary *response) {
        if (response) {
            [weakSelf progressHUDHideImmediately];
            TDMinePWCheckYanZhengC *inputYanZhengCodeC = [[TDMinePWCheckYanZhengC alloc] init];
            inputYanZhengCodeC.isRegister = weakSelf.isRegister;
            inputYanZhengCodeC.phoneNumStr = phone;
            [weakSelf.navigationController pushViewController:inputYanZhengCodeC animated:YES];
        }else {
            [weakSelf progressHUDHideImmediately];
        }
    } netError:^(NSError *error) {
        [weakSelf progressHUDShowWithCompleteText:@"手机号码验证失败" isSucceed:NO];
    }];
}


@end
